package playsManager.unitTests;

import junit.framework.TestCase;
import playsManager.*;
import playsManager.database.*;
import playsManager.domainLogic.*;

public class unitTests extends TestCase
{
	Database db;
	DomainLogic dl;

	protected void setUp() throws Exception {
		super.setUp();
		db = Database.GetInstance();
		dl = DomainLogic.GetInstance();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	public void testDomainLogic() throws Exception {
		Theater t1 = new Theater();
		t1.name = "test";
		dl.AddTheater(t1); //id is set when adding
		Theater t2 = dl.GetTheater(t1.id);
		assertTrue(t1.name.equals(t2.name));
		
		Play p1 = new Play();
		p1.SetName("test");
		dl.AddPlay(p1); //id is set when adding
		Play p2 = dl.GetPlay(p1.GetId());
		assertTrue(p1.GetName().equals(p2.GetName()));
		dl.DeletePlay(p1.GetId());
	}
}
